package controller;

import model.Employee;
import database.DBEmployee;

public class CtrEmployee 
{
	private static Employee empLogedOn;
	private DBEmployee dbEmployee;
	
	private static CtrEmployee instance; 
	
	private CtrEmployee()
	{
		empLogedOn = null;
		dbEmployee = new DBEmployee();
	}
	
	public static CtrEmployee getInstance()
	{
		if(instance == null) {
			instance = new CtrEmployee();
		}
		
		return instance;
	}
	
	public boolean login(String password)
	{
		empLogedOn = dbEmployee.getEmployeeFromPass(password);
		
		return empLogedOn != null;
	}
	
	public Employee getEmployeeLogedOn()
	{
		return empLogedOn;
	}
	
}
